package com.kitchen.api.controller;

import com.kitchen.common.vo.ResultVO;
import com.kitchen.beans.entity.Category;
import com.kitchen.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 78468
 * 分类接口
 */
@RestController
@RequestMapping("/category")
@CrossOrigin
@Api(tags = "商品分类接口", value = "用于管理商品分类")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @RequestMapping(value = "/display", method = RequestMethod.GET)
    @ApiOperation("显示商品")
    public ResultVO display() {
        return categoryService.showAllProducts();
    }

    @RequestMapping(value = "/increaseHeat", method = RequestMethod.POST)
    @ApiOperation("增加商品热度")
    @ApiImplicitParam(dataType = "Category", required = true, name = "category", value = "商品分类id")
    public ResultVO increaseHeat(@RequestBody Category category) {
        return categoryService.increaseThePopularityOfGoods(category);
    }


}
